package com.isunland.managesystem.adapter;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseButterKnifeAdapter;
import com.isunland.managesystem.base.BaseVolleyActivity;
import com.isunland.managesystem.entity.KnowledgeAnnounceList.KnowledgeAnnounceDetail;
import java.util.ArrayList;

//public class PublishAnnounceListAdapter extends BaseShadowListAdapter<KnowledgeAnnounceDetail> {
//
//  public PublishAnnounceListAdapter(Context context, List<KnowledgeAnnounceDetail> objects) {
//    super(context, objects);
//  }
//
//  public PublishAnnounceListAdapter(Context context, KnowledgeAnnounceDetail[] objects) {
//    super(context, objects);
//  }
//
//  @Override public void bindData(int position, ViewHolder vh, KnowledgeAnnounceDetail item) {
//    vh.mContentOneTv.setText(item.getDocKindName());
//    vh.mContentOneTv.setTextColor(getContext().getResources().getColor(R.color.chocolate));
//    MyUtils.switchShadowStutus(getContext(), vh.mContentStatusTv, item.getDataStatus());
//    vh.mContentTwoTv.setText(item.getNoticeTitle());
//    vh.mContentThreeTv.setText(item.getDocKnowledgeNo());
//    vh.mPersonNameTv.setText(item.getRegStaffName());
//    vh.mPersonDataTv.setText(
//        MyDateUtil.format(MyDateUtil.parse(item.getRegDate()), MyDateUtil.TYPE_DATE));
//  }
//}

public class PublishAnnounceListAdapter extends BaseButterKnifeAdapter<KnowledgeAnnounceDetail> {

  public PublishAnnounceListAdapter(BaseVolleyActivity context,
      ArrayList<KnowledgeAnnounceDetail> objects) {
    super(context, objects);
  }

  @Override protected int setLayoutId() {
    return R.layout.adapter_company_event;
  }

  @NonNull @Override protected BaseViewHolder initHolder(View convertView) {
    return new ViewHolder(convertView);
  }

  @Override
  protected void initView(KnowledgeAnnounceDetail item, BaseViewHolder baseHolder, int position) {
    ViewHolder vh = (ViewHolder) baseHolder;
    vh.tvType.setText(item.getDocKindName());
    vh.tvBrief.setText(item.getNoticeTitle());
    vh.tvNumber.setText(item.getDocKnowledgeNo());
    vh.tvName.setText(item.getRegStaffName());
    vh.tvDate.setText(item.getRegDate());
  }

  @Override public boolean isEmpty() {
    return false;
  }

  protected class ViewHolder extends BaseViewHolder {
    @BindView(R.id.tv_type) TextView tvType;
    @BindView(R.id.tv_brief) TextView tvBrief;
    @BindView(R.id.tv_number) TextView tvNumber;
    @BindView(R.id.tv_name) TextView tvName;
    @BindView(R.id.tv_date) TextView tvDate;

    ViewHolder(View view) {
      super(view);
    }
  }
}